package com.nineclock.system.controller;

import com.nineclock.api.system.SmsControllerApi;
import com.nineclock.common.entity.Result;
import com.nineclock.system.service.SmsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/sms")
public class SmsController implements SmsControllerApi {

    @Autowired
    private SmsService smsService;

    @Override
    @GetMapping("/code")
    public Result sendSms(String mobile, String type) {
        smsService.sendSms(mobile, type);
        return Result.success();
    }


    @Override
    @GetMapping("/verify")
    public Result<Boolean> verify(String checkcode, String mobile, String type) {
        Boolean pass =  smsService.verify(checkcode, mobile, type);
        return Result.success(pass);
    }
}
